<%@page import="java.util.List"%>
<%@page import="com.oms.domain.Message" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery-3.0.0.min.js"></script>
	<script type="text/javascript">
		$(function(){
			$(".delete").click(function(){
				var href = $(this).attr("href");
				$("form").attr("action", href).submit();			
				return false;
			});
		});
	</script>
</head>
<body>
	
	<form id="form" action="" method="POST">
		<input type="hidden" name="_method" value="DELETE"/>
	</form>
	
	<a href="${pageContext.request.contextPath }/message/send/list">查看发信箱的信息</a>
	<a href="${pageContext.request.contextPath }/message/receive/list">查看收信箱的所有的信息</a>
	<a href="${pageContext.request.contextPath }/message/receive/list/unread">查看收信箱的未读信息</a>
	<a href="${pageContext.request.contextPath }/message/receive/list/readed">查看收信箱的已读信息</a>
	<c:if test="${receiveAckList!=null && receiveAckList.size()!=0}">
		<h2>已收到的信件</h2>
		<table align="center">
			<tr>
				<th>发送者</th>
				<th>消息类型</th>
				<th>标题</th>
				<th>发送时间</th>
				<th>已读状态</th>
			</tr>
		<c:forEach var="ack" items="${receiveAckList}">
	   		<tr>
   				<td>${ack.message.user.name}</td>
	   			<td>${ack.message.messageType}</td>
	   			<td><a href="${pageContext.request.contextPath}/message/receive/${ack.message.messageId}.do">${ack.message.messageTitle}</a></td>
	   			<td>${ack.message.sendTime}</td>
	   			<td>${ack.isRead}</td>
	   			<td><a class="delete" href="${pageContext.request.contextPath}/message/receive/${ack.acknowledgementId}">删除</a></td>
	   		</tr>  
	   	</c:forEach>
		</table>
	</c:if>
	
<%-- 	<c:if test="${sendMessageList!=null && sendMessageList.size()!=0}">
		<hr>
		<h2>已发送的信件</h2>
		<table align="center">
			<tr>
				<th>发送者</th>
				<th>消息类型</th>
				<th>标题</th>
				<th>发送时间</th>
				<th>已读状态</th>
			</tr>
		<c:forEach var="message" items="${messageList}">
	   		<tr>
	   			<td><a href="${pageContext.request.contextPath }/user/${message.user.userId}.do">${message.user.name}</a></td>
	   			<td>${message.messageType}</td>
	   			<td><a href="${pageContext.request.contextPath}/message/${message.messageId}.do">${message.messageTitle}</a></td>
	   			<td>${message.sendTime}</td>
	   			<td>${message.isRead}</td>
	   			<td><a class="delete" href="${pageContext.request.contextPath}/message/${message.messageId}.do">删除</a></td>
	   		</tr>  
	   	</c:forEach>
		</table>
	</c:if> --%>
</body>
</html>